define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'jizhan.discount_section/index',
        add_url: 'jizhan.discount_section/add?activityId='+activityId,
        edit_url: 'jizhan.discount_section/edit?activityId='+activityId,
        delete_url: 'jizhan.discount_section/delete',
        export_url: 'jizhan.discount_section/export',
        modify_url: 'jizhan.discount_section/modify',
    };
    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: "checkbox"},
                    {field: 'id', width: 30, title: 'ID', search: 'no'},
                    {field: 'activity_name', width: 150, title: '参与活动名称' , selectList: activityList},
                    {field: 'product_id', minWidth: 150, title: '商品ID', search: 'no'},
                    {field: 'product_name', minWidth: 150, title: '商品名称', search: 'no'},
                    {field: 'price', minWidth: 150, title: '销售价格', search: 'no'},
                    {field: 'ot_price', minWidth: 150, title: '划线价格', search: 'no'},
                    {field: 'stock', minWidth: 150, title: '活动剩余库存量', search: 'no'},
                    {field: 'sum_stock', minWidth: 150, title: '活动总库存量', search: 'no'},
                    {field: 'type', minWidth: 150, title: '是否显示在首页', search: 'no'},

                    {
                        field: 'status',
                        minWidth: 100,
                        title: '状态',
                        selectList: {0: "关闭", 1: "开始"},
                        templet: ea.table.switch
                    },
                    {field: 'remark', minWidth: 100, title: '备注说明', search: 'no'},
                    {field: 'create_time', minWidth: 120, title: '创建时间', search: 'no'},
                    {
                        width: 250, title: '操作', templet: ea.table.tool,
                        operat: ['edit','delete']
                    }
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});